home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.19990725-20000114
/
000326_news@columbia.edu _Wed Dec 8 03:34:33 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2000-01-13
|
2KB
Return-Path: <news@columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id DAA17419
for <kermit.misc@watsun.cc.columbia.edu>; Wed, 8 Dec 1999 03:34:33 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id DAA24491
for kermit.misc@watsun.cc.columbia.edu; Wed, 8 Dec 1999 03:20:33 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
Date: Wed, 8 Dec 1999 00:21:08 -0700
From: <Use-Author-Address-Header@[127.1]>
Message-ID: <TCPSMTP.19.12.8.0.21.8.2375661496.5936655@kincyb.com>
Subject: ANSI stripping script
Organization: mail2news@nym.alias.net
To: kermit.misc@columbia.edu
(previously posted to the old seder mailing list,
now sed users.)
The following sed script I've sometimes found usefull
to strip ANSI control sequences out of C-Kermit
log files if needed. Maybe there is some better way
to do this, and I don't claim this to be perfect,
but it seems to work about as good as a DOS program
I tried out for the purpose, and is much more portable.
#!/bin/sed -f
#
# ANSI2TXT.SED
#
# sed script to strip out ANSI escape sequences
#
# Dallas E. Legan II 04/12/98
# dallasii@kincyb.com
# leganii@surfree.com
#
#
# based on ANSI escape sequences listed in
# 'Writing DR DOS Batch Files' by Ronnie Richardson
# Windcrest/McGraw-Hill, (c) 1993, pages 169-170
#
#
# Replace: 'ESC' with ASCII 27, the 'escape character'
# ^M, ^@, ^H with their control characters
# on the last line
# for a functional script.
#
:punct
# worked with GNU sed 2.05 for OS/2:
# s/ESC[[=?c]/ESC/g
#
# worked with GNU sed 3.02 with Debian 2.1 Linux:
s/ESC[[=?c]/ESC/g
t punct
s/ESC[0-9r]*[:;]/ESC/g
t punct
s/ESC[0-9fH]*[A-Za-z]//g
s/[ESC^A^H]//g
Regards, Dallas E. Legan
dallasii
@
kincyb
.
com
leganii
@
surfree
.
com